import {ref, computed} from 'vue'

const useAssetsStore = defineStore('assetsResource', () => {
        const gridSize = ref(localStorage.getItem('qiwen_grid_size')
            ? Number(localStorage.getItem('qiwen_grid_size'))
            : 80);
        const getterGridSize = computed(() => {
            return gridSize.value;
        });
        const setterGridSize = (value) => {
            gridSize.value = value;
        }

        const selectedColumnList = ref(localStorage.getItem('qiwen_selected_column_list'));
        const getterSelectedColumnList = computed(() => {
            return selectedColumnList.value;
        });
        const setterSelectedColumnList = (value) => {
            selectedColumnList.value = value;
        }

        const fileModal = ref(localStorage.getItem('qiwen_file_model'));
        const getterFileModal = computed(() => {
            return fileModal.value;
        });
        const setterFileModal = (value) => {
            fileModal.value = value;
        }

        const isBatchOperation = ref(false);
        const getterIsBatchOperation = computed(() => {
            return isBatchOperation.value;
        })
        const setterIsBatchOperation = (value) => {
            isBatchOperation.value = value;
        }

        const showUploadMask = ref(false);
        const getterShowUploadMask = computed(() => {
            return showUploadMask.value;
        })
        const setterShowUploadMask = () => {
            showUploadMask.value = !showUploadMask.value;
        }

        const selectedFiles = ref([]);
        const getterSelectedFiles = computed(() => {
          return selectedFiles.value;
        })
        const setterSelectedFiles = (value) => {
            selectedFiles.value = value;
        }

        return {
            gridSize,
            getterGridSize,
            setterGridSize,
            selectedColumnList,
            getterSelectedColumnList,
            setterSelectedColumnList,
            fileModal,
            getterFileModal,
            setterFileModal,
            isBatchOperation,
            getterIsBatchOperation,
            setterIsBatchOperation,
            showUploadMask,
            getterShowUploadMask,
            setterShowUploadMask,
            selectedFiles,
            getterSelectedFiles,
            setterSelectedFiles,
        };
})

export default useAssetsStore

